package com.multidisplay.controller;

import com.multidisplay.po.BaseData;
import com.multidisplay.po.DisplayList;
import com.multidisplay.service.impl.BaseDataServiceImpl;
import com.multidisplay.service.impl.DisplayListServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@Api(tags="播放列表管理相关接口")
public class DisplayListController {
    @Autowired
    private DisplayListServiceImpl displayListService;

    @PostMapping("/displaylistadd")
    @ApiOperation("增加DisplayList")
    public void add(DisplayList displayList){
        displayListService.add(displayList);
    }

    @DeleteMapping("/displaylistdelById")
    @ApiOperation("根据id删除DisplayList")
    public void delById(int id){
        displayListService.delById(id);
    }

    @DeleteMapping("/displaylistdelByBdId")
    @ApiOperation("根据bdId删除其中某视频")
    public void delByBdId(int bdId){
        displayListService.delByBdId(bdId);
    }

    @GetMapping("/displaylistselectById")
    @ApiOperation("根据id查询DisplayList")
    public List<DisplayList> selectById(int id){
        return displayListService.selectById(id);
    }

    @GetMapping("/displaylistselectByVdId")
    @ApiOperation("根据vdId查询DisplayList")
    public List<DisplayList> selectByVdId(int vdId){
        return displayListService.selectByVdId(vdId);
    }

    @GetMapping("/displaylistselectAll")
    @ApiOperation("查询所有")
    public List<DisplayList> selectAll(){
        return displayListService.selectAll();
    }

    @PutMapping("/displaylistupdate")
    @ApiOperation("更新DisplayList")
    public void update(DisplayList displayList){
        displayListService.update(displayList);
    }

}